package com.sky.common.http;

import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;

import java.io.IOException;

/**
 * http客户端
 *
 */
public class HttpDecorate {
    private final CloseableHttpClient closeableHttpClient;

    protected HttpDecorate(CloseableHttpClient closeableHttpClient) {
        this.closeableHttpClient = closeableHttpClient;
    }


    public HttpDecorateResponse execute(HttpUriRequest request) throws IOException {
        HttpResponse response = this.closeableHttpClient.execute(request);
        return HttpDecorateResponse.build(response);
    }


}
